Skip to content

scripts(configure_dev): conditional tap homebrew#5573

Merged
cce merged 4 commits intoalgorand:masterfrom
GoPlausible:master
Aug 31, 2023
Merged

scripts(configure_dev): conditional tap homebrew#5573
cce merged 4 commits intoalgorand:masterfrom
GoPlausible:master

Conversation

@emg110
Copy link
Copy Markdown
Contributor

@emg110 emg110 commented Jul 16, 2023

Summary

In OSX, homebrew does not need to tap in versions above "2.5.0", so this PR adds a condition to check that before running brew tap homebrew/cask and does not proceed with tap for homebrew versions above "2.5.0"

Test Plan

Tested on an old and new MacOS with homebrew versions above and below 2.5.0 and it does detect and work fine!
Dear reviewers, please inform me if there is a need to make a unit test using frameworks like bats or shunit2! But since it was just a small modification I humbly considered It would not be necessary!

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 16, 2023

Codecov Report

Merging #5573 (10b85d1) into master (d316914) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #5573   +/-   ##
=======================================
  Coverage   55.79%   55.79%           
=======================================
  Files         446      446           
  Lines       63418    63418           
=======================================
+ Hits        35381    35386    +5     
+ Misses      25668    25667    -1     
+ Partials     2369     2365    -4     

see 11 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

winder
winder previously approved these changes Jul 21, 2023
Copy link
Copy Markdown
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Homebrew 2.4.0 is over 3 years old, I'd be tempted to remove this line entirely.

Comment thread scripts/configure_dev.sh Outdated
Comment thread scripts/configure_dev.sh Outdated
@emg110 emg110 requested a review from bbroder-algo July 24, 2023 09:57
Copy link
Copy Markdown
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm less comfortable with this change than the original for the following reasons:

  • Much more code. AFAIK the current code isn't specifically broken, so I'm generally a bit hesitant about seeing this code change.
  • It doesn't work for the following inputs: compare_semantic_version "2.5.0" "", compare_semantic_version "2.5.0" "2".
  • There are too many print statements.

Instead of a semantic version check, perhaps testing the exit code of brew casks can be used? I'm not a brew user, so I found that command in the docs.

@emg110
Copy link
Copy Markdown
Contributor Author

emg110 commented Jul 24, 2023

In general, you are right @winder! Since inputs are expected to be semantic versions and "" and "2" are not semantic versions they produce wrong responses! I will tweak the code and address all your mentioned points! Thank you!

@emg110
Copy link
Copy Markdown
Contributor Author

emg110 commented Jul 24, 2023

And current code breaks on new brew versions (in some regions because it was ok over VPN to the USA) and that's why I made this change! I was running from source code on Ubuntu so far and this was the first time I tried on MacOS and configure_dev.sh script failed! I thought it's worth mentioning!

@emg110
Copy link
Copy Markdown
Contributor Author

emg110 commented Jul 25, 2023

Hey @winder : now it is 0 message and just silently does the job and no additional code file and least code added (4 lines only)
Hey @bbroder-algo : The comparison is now on Major.Minor as a decimal number so your great point is addressed as well
This now satisfy all your great comments (@winder & @bbroder-algo) during reviews, IMHO! Gladly open to any new comments BTW!

@emg110 emg110 requested a review from winder July 25, 2023 11:15
Copy link
Copy Markdown
Contributor

@bbroder-algo bbroder-algo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@emg110
Copy link
Copy Markdown
Contributor Author

emg110 commented Aug 2, 2023

@winder my man, any chance you can take a look at this very humble PR status? Million thanks in advance my friend!

@winder winder requested a review from bbroder-algo August 17, 2023 19:34
Copy link
Copy Markdown
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bearing with us. The improvements look good.

@emg110
Copy link
Copy Markdown
Contributor Author

emg110 commented Aug 18, 2023

@bbroder-algo , @winder , Thank you both for your time! The PR is not merged yet!

@cce cce added the Bug-Fix label Aug 31, 2023
@cce cce merged commit ade30a8 into algorand:master Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants